<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<script type="text/javascript">
    var exampleSocket = new WebSocket("ws://120.26.68.72:9505");
    exampleSocket.onopen = function (event) {
        exampleSocket.send("亲爱的服务器！我连上你啦！");
    };
    exampleSocket.onmessage = function (event) {
        console.log(event.data);
    }
</script>

<input  type="text" id="content">
<button  onclick="exampleSocket.send( document.getElementById('content').value )">发送</button>
</body>
</html>